// run: $exec < input
#include <iostream>
#include <algorithm>
#include <string>

int const maxn = 100007;
int need[maxn];
std::string s;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> s;
	int l = s.size();
	std::reverse(s.begin(), s.end());
	if (s[l - 1] > s[0]) need[l - 1] = 1;
	else if (s[l - 1] < s[0]) { std::cout << "0\n"; return 0; }
	for (int i = 1; i <= l - i - 1; i++) {
		if (s[i] == s[l - i - 1]) need[i] = need[l - i - 1] = 4;
		else if (s[i] > s[l - i - 1]) need[i] = 1;
		else if (s[l - i - 1] > s[i]) need[l - i - 1] = 1;
	}

}

